package com.giveme5.common.exception;

import com.giveme5.common.entity.SimpleResult;


public class SimpleException extends RuntimeException {

	protected SimpleResult result;

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public SimpleException(int code) {
		SimpleResult result = new SimpleResult(code);
		this.result = result;
	}

	public SimpleResult getResult() {
		return result;
	}

	public static SimpleException createException(int code) {
		return new SimpleException(code);
	}

	@Override
	public String getMessage() {
		if (result != null) {
			return getResult().getMessage();
		} else {
			return null;
		}
	}

}
